﻿@using LY.Business.ServiceImpl
@using LY.Entity
@using LY.Entity.Entities
@using LY.Interface
@{
    ViewBag.Title = "公司认证";
    Layout = "~/Views/Shared/_LayoutFore.cshtml";
    var loginUserInfo = System.Web.HttpContext.Current.Session["CurrentUser"] as LY.Entity.U_Member;
    U_Company Company = new U_Company();
    if (ViewBag.Company != null)
    {
        Company = ViewBag.Company;
    }
    var RealName = "";
    var Mobilenumber = "";
    var IDCode = "";
    if (loginUserInfo != null)
    {
        RealName = loginUserInfo.RealName;
        Mobilenumber = loginUserInfo.Mobilenumber;
        IDCode = loginUserInfo.IDCode;
    }

    List<U_Companydocument> list = ViewBag.Companydocument;
    QJ.CMS.Controllers.AccountController.rlist.Clear();//刷新页面时清除静态变量中缓存的值
    
}

@section style{
    <style>
        #btnUploadImg1, #btnUploadImg2, #btnUploadImg3, #btnUploadImg4, #btnUploadImg5 {
            text-align: center;
            line-height: 20px;
            height: 20px;
            margin: 0px;
            padding: 0px;
            border: 0px;
            width: 130px;
            height: 25px;
            font-size: 10pt;
        }

        .form-table tr td {
            text-indent: 0px;
        }

        select {
            width: 210px;
        }

        #company tr td {
            width: 110px;
        }

        #fujian {
            margin: 20px 0px 5px 0px;
            text-align: center;
        }

            /* #fujian tr:first-child {
                width: 140px;
            }
*/
            #fujian img {
                width: 91px;
                height: 91px;
            }
    </style>
}
@section script{
    <script src="~/Content/assets/DatePicker/WdatePicker.js"></script>
    <script src="~/Content/assets/app/common/ajaxupload.js"></script>


    <!-- 批量上传图片-->
    <link href="~/webuploader/css/webuploader.css" rel="stylesheet" />
    <link href="~/webuploader/css/style.css" rel="stylesheet" />
    <link href="~/webuploader/css/demo.css" rel="stylesheet" />

    <script src="~/webuploader/js/webuploader.js"></script>
    <script src="~/webuploader/ImageJS.js"></script>

    <script type="text/javascript">
        function deleteFujianImg(id) {
            //判断认证状态
            if ('@Company.Status' == 1) {
                $.dialog.tips("该公司正在审核中，请耐心等候！", 2, 'alert.gif', function () {
                    window.location.href = "/Account/CompanyApprove";
                });
                return false;
            } else {
                if ('@Company.Status' == 2) {
                    $.dialog.confirm('确定删除吗？删除后需重新认证！', function () {
                        $.post("/Account/DeleteImages?id=" + id + "&sign=1", function (r) {
                            if (r.Status == 1) {
                                $("#" + id).remove();
                                $("#Status").html("未认证");
                            }
                        });
                    });
                } else {
                    $.dialog.confirm('确定删除吗？', function () {
                        $.post("/Account/DeleteImages?id=" + id, function (r) {
                            if (r.Status == 1) {
                                $("#" + id).remove();
                            }
                        });
                    });
                }
            }
        }

        ;

        //点击取消  刷新界面
        $("#cancel").click(function () {
            window.location.href = "/Account/index";
        });

        $("#Industry option[value='" + @Company.Industry + "']").attr("selected", true);
        $("#Nature option[value='" + @Company.Nature + "']").attr("selected", true);


        function OnSuccess(data) {
            $.dialog.tips(data.Message, 2, "tips.gif", function () {
                window.location.href = "/Account/index";
            });
        }

        if ($("#Status").html() == 0) {
            $("#Status").html("未认证");
        } else if ($("#Status").html() == 1) {
            $("#Status").html("审核中");
        } else if ($("#Status").html() == 2) {
            $("#Status").html("已认证");
        } else {
            $("#Status").html("未通过");
            $("#Reason").css('display', '');
        }


        $(function () {
            //编辑器
            var url = "/Account/UpLoadProcess";
            upload("#fileList1", "#filePicker1", url, true); //相关文件


            //点击提交时
            var status = $("#Status").html();
            $("#btnSubmit").click(function () {
                //提交时，页面信息必须都填写完整
                //验证初始化
                $("form").Validform({
                    tiptype: 3
                });

                if (status == "审核中") {
                    $.dialog.tips("该公司正在审核中，请耐心等候！", 2, 'alert.gif', function () {
                        window.location.href = "/Account/CompanyApprove";
                    });
                    return false;
                }
            });
            //点击保存时
            $("#btnSave").click(function () {
                //保存时，不用填写完整
                //移除所有input的datatype属性
                $("input").removeAttr("datatype");
                //移除textarea的datatype属性
                $("textarea").removeAttr("datatype");

                if (status == "审核中") {
                    $.dialog.tips("该公司正在审核中，请耐心等候！", 2, 'alert.gif', function () {
                        window.location.href = "/Account/CompanyApprove";
                    });
                    return false;
                }
            });


        });
    </script>
}
<div class="RightContrent">
    <div style="margin-left: 50px; margin-right: 50px;">
        <div class="tab-content">
            <div class="line10"></div>
            <div class="line10"></div>
            <div class="tab_title">@ViewBag.Title</div>
            <div class="tab-content">
                <div style="width: 16px; height: 12px; float: left;">
                    <img src="~/Content/Images/leftarraw.png" />
                </div>
            </div>

            <div class="tab-content_border">


                <div class="u-form-wrap">
                    @using (Ajax.BeginForm("SaveCompanyInfo", new AjaxOptions() { OnSuccess = "OnSuccess" }))
                    {
                        <input type="hidden" id="Id" name="Id" value="@Company.Id"/>
                        <table class="form-table" id="company">
                            <tr style="height: 80px; vertical-align: top; margin: 0px 0px">
                                <td colspan="4">审核状态：
                                    <label id="Status" name="Status" style="color: red">@Company.Status</label>
                                    <br />
                                    <label id="Reason" name="Reason" style="display: none">未通过原因：<span style="color: red">@Company.Reason</span></label>
                                </td>
                            </tr>

                            <!--必填区域-->
                            <tr>
                                <td><span style="color: red">*</span>&nbsp;公司名称：
                                   
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="CompanyName" name="CompanyName"  value="@Company.CompanyName" datatype="*" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                                <td><span style="color: red">*</span>&nbsp;注册资本(元)：
                                    
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="Registercapital" name="Registercapital"  value="@Company.Registercapital" datatype="*" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                            </tr>

                            <tr>
                                <td><span style="color: red">*</span>&nbsp;公司行业：   
                                   
                                </td>
                                <td>
                                    @Html.ResourceDropDownList("Industry", "Industry", @Company.Industry, new { @class = "wh200 select" })
                                </td>
                                <td><span style="color: red">*</span>&nbsp;公司性质：   
                                   
                                </td>
                                <td>
                                    @Html.ResourceDropDownList("Nature", "Nature", @Company.Nature, new { @class = "wh160 select" })
                                </td>
                            </tr>

                            <tr>

                                <td><span style="color: red">*</span>&nbsp;法人代表：
                                  
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="Corporate" name="Corporate"  style="color: gray" readonly="readonly" value="@RealName" datatype="*" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>

                                <td><span style="color: red">*</span>&nbsp;成立日期：
                                  
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="EstablishTime" name="EstablishTime" onclick = "WdatePicker();" value="@Company.EstablishTime" datatype="date" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                            </tr>

                            <tr>
                                <td><span style="color: red">*</span>&nbsp;法人代表身份证号：
                                   
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="CorporateIDCard" name="CorporateIDCard" readonly="readonly" style="color: gray" value="@IDCode" datatype="idcard" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                                <td><span style="color: red">*</span>&nbsp;法人代表手机号码：
                                   
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="CorporateTel" name="CorporateTel"  value="@Mobilenumber" datatype="m" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                            </tr>

                            <tr>
                                <td><span style="color: red">*</span>&nbsp;经营地址：
                                   
                                </td>
                                <td>
                                    <textarea class="input normal" id="ManageAdree" name="ManageAdree" datatype="*" nullmsg=" " sucmsg=" " errormsg=" ">@Company.ManageAdree</textarea>
                                </td>

                                <td><span style="color: red">*</span>&nbsp;注册地址：
                                   
                                </td>
                                <td>
                                    <textarea class="input normal" id="Adress" name="Adress" datatype="*" nullmsg=" " sucmsg=" " errormsg=" ">@Company.Adress</textarea>
                                </td>


                            </tr>
                            <tr>
                                <td><span style="color: red">*</span>&nbsp;联系人姓名：
                                  
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="MemberName" name="MemberName"  value="@RealName" datatype="*" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                                <td><span style="color: red">*</span>&nbsp;联系人电话：
                                   
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="MemberTel" name="MemberTel"  value="@Mobilenumber" datatype="*" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                            </tr>

                            <!--可不填区域-->
                            <tr>
                                <td>公司邮编：  
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="Postcode" name="Postcode"  value="@Company.Postcode" />
                                </td>
                                <td>单位传真：   
                                 
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="Faxes" name="Faxes" value="@Company.Faxes" />
                                </td>
                            </tr>

                            <tr>
                                <td>公司网址：   
                                   
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="URL" name="URL" value="@Company.Faxes" />
                                </td>
                                <td>E_mail：   
                                   
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="Email" name="Email" value="@Company.Email" datatype="e" nullmsg=" " sucmsg = " " errormsg =" "/>
                                </td>
                            </tr>

                            <tr>
                                <td>ICP(ISP)证号：   
                                   
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="ICP" name="ICP" value="@Company.ICP" />
                                </td>
                                <td>单位电话：   
                                 
                                </td>
                                <td>
                                    <input type="text" class="input normal" id="UnitTel" name="UnitTel" value="@Company.UnitTel" />
                                </td>
                            </tr>
                        </table>
               
                     
                        <!--公司附件区域-->
                        <table class="form-table" id="fujian">
                            <tr>
                                <td style="width: 140px;">企业证件(四证)：</td>
                                <td>
                                    <div id="fileList1">
                                        @if (list != null)
                                        {
                                            for (var i = 0; i < list.Count; i++)
                                            {
                                            <div id="@list[i].Id" class="cp_img" onclick="deleteFujianImg(@list[i].Id)">
                                                <img  src="@list[i].DocPath" />
                                                <div class="cp_img_jian"></div>
                                            </div>
                                            }
                                        }
                                    </div>
                                    <div class="cp_img_jia" id="filePicker1"></div>
                                </td>
                            </tr>

                        </table>
                        <input id="hid_pic" name="hid_pic" type="hidden" value="" />
                        <div class="u-form-page">
                            <input type="submit" class="btn" id="btnSave" name="btnSave" value="保存草稿" onkeydown="if(event.keyCode==13) return false;" />
                            <input type="button" class="btn" value="取消" id="cancel" />
                            <input type="submit" class="btn" value="提交" id="btnSubmit" name="btnSave" onkeydown="if(event.keyCode==13) return false;" />

                        </div>
                    }
                </div>
            </div>

        </div>
    </div>
</div>

